package com.itheima.service.impl;

import com.itheima.dao.AccountDao;
import com.itheima.pojo.Account;
import com.itheima.service.AccountService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class AccountServiceImpl implements AccountService {
    @Autowired
    private AccountDao accountDao;

    public void transfer(String fromName, String toName, double money) {
    //1. 转出账户扣款
        accountDao.updateAccount(new Account(null,fromName,-money));
        //出现异常
        int num = 10/0;
        //2. 转入账户收款
        accountDao.updateAccount(new Account(null,toName,money));
    }
}
